import type { RouteRecordRaw } from 'vue-router'
// 扩展 RouteMeta 接口
declare module 'vue-router' {
  interface RouteMeta {
    title?: string
    icon?: string
    isAuth?: boolean
    isPage?: boolean
    showNext?: boolean
  }
}

/**
 * 定义静态路由（默认路由）
 * 前端添加路由，请在此处加
 */
export const staticRoutes: Array<RouteRecordRaw> = []

/**
 * 定义404、401界面
 */
export const notFoundAndNoPower: Array<RouteRecordRaw> = [
  {
    path: '/:path(.*)*',
    name: 'staticRoutes.notFound',
    component: () => import('@/views/error/404.vue'),
    meta: {
      isHide: true
    }
  },
  {
    path: '/401',
    name: 'staticRoutes.noPower',
    component: () => import('@/views/error/401.vue'),
    meta: {
      isHide: true
    }
  }
]

/**
 *  基础性路由
 *
 * 所有节点都是挂载此节点下
 */
export const baseRoutes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Root',
    component: () => import('@/library/layouts/index.vue'),
    meta: {
      title: '首页'
    },
    children: [
      {
        name: 'Home',
        path: '/',
        component: () => import('@/views/home/index.vue'),
        meta: {
          title: '首页',
          icon: undefined,
          isPage: false,
          isAuth: false
        }
      },
      {
        name: 'MhDetail',
        path: '/mhdetail',
        component: () => import('@/views/mhdetail/index.vue'),
        meta: {
          title: '详情',
          icon: undefined,
          isPage: true,
          isAuth: false
        }
      },
      {
        name: 'Detail',
        path: '/detail',
        component: () => import('@/views/detail/index.vue'),
        meta: {
          title: '详情',
          icon: undefined,
          isPage: true,
          isAuth: false
        }
      },
      {
        name: 'Classify',
        path: '/classify',
        component: () => import('@/views/clasiify/index.vue'),
        meta: {
          title: '分类',
          icon: undefined,
          isPage: false,
          isAuth: false
        }
      },
      {
        name: 'User',
        path: '/user',
        component: () => import('@/views/user/index.vue'),
        meta: {
          title: '角色',
          icon: undefined,
          isPage: false,
          isAuth: false
        }
      },
      {
        name: 'Tag',
        path: '/tag',
        component: () => import('@/views/tag/index.vue'),
        meta: {
          title: '标签',
          icon: undefined,
          isPage: false,
          isAuth: false
        }
      },
      {
        name: 'Today',
        path: '/today',
        component: () => import('@/views/today/index.vue'),
        meta: {
          title: '今日更新',
          icon: undefined,
          isPage: false,
          isAuth: false
        }
      },
      {
        name: 'Selected',
        path: '/selected',
        component: () => import('@/views/selected/index.vue'),
        meta: {
          title: '精选',
          icon: undefined,
          isPage: false,
          isAuth: false
        }
      },
      {
        name: 'UserPage',
        path: '/userPage',
        component: () => import('@/views/userPage/index.vue'),
        meta: {
          title: '用户页',
          icon: undefined,
          isPage: true,
          isAuth: false
        }
      },
      {
        name: 'My',
        path: '/my',
        component: () => import('@/views/my/index.vue'),
        meta: {
          title: '我的页面',
          icon: undefined,
          isPage: false,
          isAuth: false
        },
        children: [
          {
            name: 'UserHome',
            path: '/my',
            component: () => import('@/views/my/page/home/index.vue'),
            meta: {
              title: '个人中心',
              icon: undefined,
              isPage: false,
              isAuth: false
            }
          },
          {
            name: 'UserFollow',
            path: 'follow',
            component: () => import('@/views/my/page/follow/index.vue'),
            meta: {
              title: '我的关注',
              icon: undefined,
              isPage: false,
              isAuth: false
            }
          },
          {
            name: 'UserColl',
            path: 'coll',
            component: () => import('@/views/my/page/coll/index.vue'),
            meta: {
              title: '我的收藏',
              icon: undefined,
              isPage: false,
              isAuth: false
            }
          },
          {
            name: 'Footprint',
            path: 'footprint',
            component: () => import('@/views/my/page/footprint/index.vue'),
            meta: {
              title: '我的足迹',
              icon: undefined,
              isPage: false,
              isAuth: false
            }
          },
          {
            name: 'UserUpload',
            path: 'upload',
            component: () => import('@/views/my/page/upload/index.vue'),
            meta: {
              title: '我的上传',
              icon: undefined,
              isPage: false,
              isAuth: false
            }
          },
          {
            name: 'UserDownload',
            path: 'download',
            component: () => import('@/views/my/page/download/index.vue'),
            meta: {
              title: '我的购买',
              icon: undefined,
              isPage: false,
              isAuth: false
            }
          },
          {
            name: 'UserOrder',
            path: 'order',
            component: () => import('@/views/my/page/order/index.vue'),
            meta: {
              title: '订单',
              icon: undefined,
              isPage: false,
              isAuth: false
            }
          },
          {
            name: 'UserIncome',
            path: 'income',
            component: () => import('@/views/my/page/income/index.vue'),
            meta: {
              title: '我的收益',
              icon: undefined,
              isPage: false,
              isAuth: false
            }
          },
          {
            name: 'UserPayouts',
            path: 'payouts',
            component: () => import('@/views/my/page/income/payouts.vue'),
            meta: {
              title: '提现',
              icon: undefined,
              isPage: false,
              isAuth: false
            }
          },
          {
            name: 'UserVip',
            path: 'vip',
            component: () => import('@/views/my/page/vip/index.vue'),
            meta: {
              title: '会员',
              icon: undefined,
              isPage: false,
              isAuth: false
            }
          },
          {
            name: 'UserTask',
            path: 'task',
            component: () => import('@/views/my/page/task/index.vue'),
            meta: {
              title: '任务',
              icon: undefined,
              isPage: false,
              isAuth: false
            }
          },
          {
            name: 'UserCoupons',
            path: 'coupons',
            component: () => import('@/views/my/page/coupons/index.vue'),
            meta: {
              title: '任务',
              icon: undefined,
              isPage: false,
              isAuth: false
            }
          },
          {
            name: 'UserMessage',
            path: 'message',
            component: () => import('@/views/my/page/message/index.vue'),
            meta: {
              title: '消息',
              icon: undefined,
              isPage: false,
              isAuth: false
            }
          },
          {
            name: 'UserInfo',
            path: 'info',
            component: () => import('@/views/my/page/info/index.vue'),
            meta: {
              title: '我的',
              icon: undefined,
              isPage: false,
              isAuth: false
            }
          }
        ]
      }
    ]
  }
]
